-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【Hackathon No.27】为 Paddle 新增 frac 数学计算API #41226
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
PR-CI-Mac-Python3和PR-CI-Inference 是需要通过的噢~ |
你好,已经通过了~ |
out_ref = ref_frac(self.x_np) | ||
self.assertTrue(np.allclose(out_ref, res)) | ||
|
||
def test__dygraph_api(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test__dygraph_api->test_dygraph_api
x = paddle.to_tensor(self.x_np) | ||
out = paddle.frac(x) | ||
out_ref = ref_frac(self.x_np) | ||
self.assertTrue(np.allclose(out_ref, out.numpy())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
根据验收标准,请多补充下测试case。
- 目前只测了float32,请补充下int32, int64, float64的case
- 需要有
test_errors
异常的测试,可以测一下dtype不在上述4个类型中的情况
@luotao1 你好,已修改。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
主体功能LGTM,还需要过一下static-check流水线,同时增加中文文档
python/paddle/tensor/__init__.py
Outdated
@@ -452,6 +453,7 @@ | |||
'digamma', | |||
'diagonal', | |||
'trunc', | |||
'frac' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2022-04-07 21:45:56 API Difference is:
2022-04-07 21:45:56 - paddle.Tensor.bitwise_and (ArgSpec(args=['x', 'y', 'out', 'name'], varargs=None, varkw=None, defaults=(None, None), kwonlyargs=[], kwonlydefaults=None, annotations={}), ('document', '16c92f81b99632969af31978cf06dcbd'))
2022-04-07 21:45:56 + paddle.bitwise_and (ArgSpec(args=['x', 'y', 'out', 'name'], varargs=None, varkw=None, defaults=(None, None), kwonlyargs=[], kwonlydefaults=None, annotations={}), ('document', '16c92f81b99632969af31978cf06dcbd'))
static-check流水线显示:https://xly.bce.baidu.com/paddlepaddle/paddle/newipipe/detail/5338157/job/13849637
这里少了一个逗号。
@@ -263,6 +263,7 @@ | |||
from .tensor.math import fmin # noqa: F401 | |||
from .tensor.math import inner # noqa: F401 | |||
from .tensor.math import outer # noqa: F401 | |||
from .tensor.math import frac # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要在下面的__all__
列表里加上frac
CI错误可以试一下merge develop,https://github.com/Asthestarsfalll/Paddle/tree/frac 落后212个 |
多谢提醒! |
已添加中文文档 |
PR-CI-Windows和PR-CI-Windows-Inference这两个CI是需要通过的哦~ |
@dingjiaweiww 你好,已通过 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
APIs
Describe
解决了issue:#40306
增加了paddle.frac和Tensor.frac。具体地,
paddle.frac
可以返回输入tensor的小数部分。设计文档:PaddlePaddle/community#51
中文文档:PaddlePaddle/docs#4539